<template>
	<view class="content">
		<!-- <image style="width: 100%;height: 100%;" src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/common/start.png" mode=""></image> -->
		<view class="cover">
			<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/start/top.png" class="topleft" mode="widthFix"></image>
			<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/start/logo_white.png" class="center" mode="widthFix"></image>
			<image src="https://yzxk.oss-cn-hangzhou.aliyuncs.com/images/start/titile.png" class="bottom_image" mode="widthFix"></image>
		</view>
		<privacyPopup v-if="ishow"></privacyPopup>
	</view>
</template>

<script>
import privacyPopup from '@/components/privacyPopup/privacyPopup.vue';
import { memberLabel } from '../../apis/apis.js';
export default {
	components: {
		privacyPopup
	},
	data() {
		return {
			ishow: false
		};
	},
	onShow() {
		this.pages();
	},
	methods: {
		pages() {
			const token = uni.getStorageSync('token');
			// 登录之后
			if (token) {
				// #ifdef APP-PLUS
				this.ishow = true;
				// #endif
				// #ifdef H5 || MP-WEIXIN
				// setTimeout(()=>{
				this.judeUserSelectIndustry();
				// },500)
				// #endif
				// 判断是否第一次打开app,进行政策弹窗
				const boo = uni.getStorageSync('openForFirstTime');
				if (boo) {
					// setTimeout(() => {
					if (!uni.getStorageSync('currentPage')) {
						// 在此处判断用户是否选择了行业&岗位
						this.judeUserSelectIndustry();
					} else {
						uni.navigateTo({
							url: uni.getStorageSync('currentPage')
						});
					}
					// }, 500)
				}
			} else {
				// setTimeout(() => {
				uni.reLaunch({
					url: '/pages/login/login'
				});
				// }, 1000)
			}
		},
		/* 判断用户是否选择了行业&岗位，已选择-跳转已知首页，未选择-跳转选择页面 2023-01-07 **/
		judeUserSelectIndustry() {
			memberLabel().then(response => {
				let t_memberLabelVo = response.data || response.rows || null;
				t_memberLabelVo && uni.setStorageSync('local_memberLabelVo', JSON.stringify(t_memberLabelVo));
				return;
				let label = response.data.labelPostIds || '';
				// 未选择岗位
				if (!Boolean(label)) {
					uni.redirectTo({
						url: '/pages/occupation/occupationChoice/occupationChoice?first=true'
					});
				} else {
					uni.switchTab({
						url: '/pages/index/index'
					});
				}
			});
			uni.switchTab({
				url: '/pages/index/index'
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.content {
	position: relative;
	width: 100vw;
	height: 100vh;

	.cover {
		width: 100%;
		height: 100%;
		background-color: #194fc9;

		.topleft {
			position: fixed;
			right: 5%;
			top: 5%;
			width: 20%;
		}

		.center {
			position: fixed;
			width: 18%;
			left: 50%;
			top: 35%;
			transform: translateX(-50%);
		}

		.bottom_image {
			position: fixed;
			bottom: 5%;
			left: 50%;
			transform: translateX(-50%);
			width: 40%;
		}
	}

	.box {
		position: absolute;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		display: flex;
		flex-direction: column;
		align-items: center;

		& > image {
			width: 200rpx;
			height: 200rpx;
		}

		.text {
			font-size: 30rpx;
			font-weight: bold;
			color: #194FC9;
		}
	}
}
</style>
